package ${packageName}.service.impl;

import com.ailanyin.mapper.${mapperName};
import com.ailanyin.model.${modelName};
import com.ailanyin.admin.service.${serviceName};
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
* @author ailanyin
* @version 1.0
* @since ${.now?string('yyyy-MM-dd hh:mm:ss')}
*/
@Service
public class ${serviceName}Impl implements ${serviceName} {

    @Resource
    private ${mapperName} ${mapperName?uncap_first};

    @Override
    public List<${modelName}> getListByParam(${modelName} ${modelName?uncap_first}) {
        return ${mapperName?uncap_first}.selectList(${modelName?uncap_first});
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void insert${modelName}(${modelName} ${modelName?uncap_first}) {
        ${modelName?uncap_first}.setCreateTime(new Date());
        ${mapperName?uncap_first}.insertSelective(${modelName?uncap_first});
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update${modelName}(${modelName} ${modelName?uncap_first}) {
        ${mapperName?uncap_first}.updateByPrimaryKeySelective(${modelName?uncap_first});
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteByIds(Long[] ids) {
        ${mapperName?uncap_first}.deleteByIds(ids);
    }

    @Override
    public ${modelName} getInfo(Long id) {
        return ${mapperName?uncap_first}.selectByPrimaryKey(id);
    }

}
